package model.query;

import main.HibernateUtil;
import org.hibernate.Session;
import model.*;

/**
 *
 * @author cska
 *
 */

public class Delete {

    private Session session;

    public Delete() {
        super();
    }

    private void begin() {
        session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
    }

    private void commit() {
        session.getTransaction().commit();
    }

    public void group(Group group) {
        begin();
        session.delete(group);
        commit();
    }

    public void teacher(Teacher teacher) {
        begin();
        session.delete(teacher);
        commit();
    }

    public void subject(Subject subject) {
        begin();
        session.delete(subject);
        commit();
    }

    public void student(Student student) {
        begin();
        session.delete(student);
        commit();
    }

    public void lesson(Lesson lesson) {
        begin();
        session.delete(lesson);
        commit();
    }

    public void skip(Skip skip) {
        begin();
        session.delete(skip);
        commit();
    }

    public void gts(Group_Teacher_Subject gts) {
        begin();
        session.delete(gts);
        commit();
    }

    public void lab(Lab lab) {
        begin();
        session.delete(lab);
        commit();
    }

    public void ls(Lab_Student ls) {
        begin();
        session.delete(ls);
        commit();
    }

    public void interim(Interim interim) {
        begin();
        session.delete(interim);
        commit();
    }

    public void admin(Admin admin) {
        begin();
        session.delete(admin);
        commit();
    }

}
